package jdbc3_25.homework;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

public class JDBCDemo05 {
    public static void main(String[] args) {
try(Connection connection = DBUtil01.getConnection();){
    Statement statement = connection.createStatement();

    String sql ="SELECT id,name,salary,title " +
            "FROM teacher";

    ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
    int id = rs.getInt(1);
    String name = rs.getString(2);
    int salary = rs.getInt(3);
    String title = rs.getString(4);
    System.out.println(id + " " + name + " " + salary + " " + title);
}
}catch (Exception e){
            e.printStackTrace();
        }
    }
}
